#include<stdio.h>

int main()
{
	int m,n,sum,t;
	scanf("%d%d",&m,&n);
	while ((m!=0)&&(n!=0))
	{
		sum=0;
		t=1;
		if (m%n==0)
		{
			if (m==n)
				sum=1;
			else
			{
				while (m>t*n)
				{
					sum+=t+1;
					m-=t*n;
					t++;
				}
				sum+=m/n;
			}
		} 
		else
		{
			while (m>t*n)
			{
				sum+=t+1;
				m-=t*n;
				t++;
			}
			sum+=m/n+1;
		}
		printf("%d\n",sum);
		scanf("%d%d",&m,&n);
	}
	return 0;
}
